<?php
/**
 * Created by PhpStorm.
 * User: *!N.J
 * Date: 2021/10/9
 * Time: 22:26
 * QQ:1467572213
 */

namespace app\admin\controller;

use library\Controller;
use think\facade\Request;
use think\facade\Session;
use \app\admin\model\Count as Count_m;

/**
 * 代理统计
 * Class Goods
 * @package app\admin\controller
 */
class Count extends Controller
{
    /**
     * 代理统计
     *@auth true
     *@menu true
     */
    public function index()
    {
        $start_time = Request::get('start_time', date('Y-m-d'));
        $end_time = Request::get('end_time', date('Y-m-d'));
        $this->assign('start_time', $start_time);
        $this->assign('end_time', $end_time);

        $dec_time = date("Y-m-d", strtotime("-1 day", strtotime("$start_time")));
        $inc_time = date("Y-m-d", strtotime("+1 day", strtotime("$start_time")));
        $this->assign('dec_time', $dec_time);
        $this->assign('inc_time', $inc_time);

        $pid_name = Request::get('pid_name');
        $this->assign('pid_name',$pid_name);
        if ($pid_name){
            $info = Count_m::index($start_time,$end_time,$pid_name);
            $this->assign('info',$info);
        }else{
            $info = null;
            $this->assign('info',$info);
        }
        return $this->fetch();
    }
}